class Factory {
    public Fruit CreateFruit(String kind) {
        if ("A".equals(kind)) return new Apple();
        if ("B".equals(kind)) return new Banana();
        return null;
    }
}